<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>系统配置参数管理</title>
</head>
<body>
    <div ng-app="configIndex" ng-controller="SysConfigCtrl">
        <div class="row">
            <ui-container url="system/sysconfig/list" key="system-sysconfig-list-00">
                <ui-search-form>
                    <search-input class="col-md-2" name="description" placeholder="参数名"></search-input>
                </ui-search-form>
                <ui-table-tool>
                    <a class="btn btn-sm btn-primary" href="javascript:void(0);" ng-click="addOpen('system/sysconfig/add')"  >新增</a>
                    <a class="btn btn-sm btn-primary" href="javascript:void(0);" onclick="reSet()">重置</a>
                </ui-table-tool>
                <ui-table dischecked="true">

                </ui-table>
                <table-page/>
            </ui-container>
        </div>
    </div>
<script>
    angular.module('configIndex',['ui.table']);
    angular.module('configIndex').controller('SysConfigCtrl', function($scope){
        function doDel(data) {
            const uiContainerCtrl=$scope['system-sysconfig-list-00'];
            $.ajax({
                url:'system/sysconfig/delete',
                data:{key:data}
            }).done(function (result) {
                if(result.code=='0000'){
                    toastr.success(result.msg);
                    uiContainerCtrl._queryData({});
                }else{
                    toastr.error(result.msg);
                }

            }).fail(function (r) {
                toastr.error("服务器异常"+r);

            });

        }
        $scope.addOpen = function (url) {
            window.reloadTable=$scope['system-sysconfig-list-00']._queryData;
            window.location.href=url;
        }
        //每一列的操作按钮
        $scope._operateColumns = [{text:'编辑',click:function (data) {
            $scope.addOpen("system/sysconfig/update.htm?id="+data.id);
        }},{text:'删除',click:function (data) {
            doDel(data.configName)
        }}]
        $scope._columns=[
            {name:'configName',head:'参数名称',id:'name'},
            {name:'configValue',head:'参数值'}
        ];
    });
    function reSet() {
        var reSetObj = $('input');
        var selectObj = $('select');
        reSetObj.val("");
        selectObj.val("");
    }
</script>
</body>
</html>
